<?php

namespace App\Api\Dao;

use App\Models\TongSystemNotice;

class SystemNoticeDao extends BaseDao
{

    /**
     * 查询构造器
     * @param $data
     * @return \Illuminate\Database\Eloquent\Builder
     */
    function getBuildQuery($data)
    {
        // TODO: Implement getBuildQuery() method.
        $query = TongSystemNotice::query();
        if(checkIsHasField($data,'id')){
            $query->where('id',$data['id']);
        }
        return $query;
    }

    /**
     * 获取系统发布的消息
     * @param array $params
     * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
     */
    public function getSystemNoticeList(array $params)
    {
        return $this->getBuildQuery($params)->paginate($params['pageSize']);
    }
}
